package com.zhang.sparksql_1

import org.apache.spark.SparkConf
import org.apache.spark.sql._

/**
 * @title:
 * @author: zhang
 * @date: 2021/12/10 19:48 
 */
object SparkSQl_HIVE {
  def main(args: Array[String]): Unit = {
    //  获取SparkSession连接对象
    val conf = new SparkConf().setMaster("local[*]").setAppName("spark-hive")
    val spark: SparkSession = SparkSession.builder().enableHiveSupport().config(conf).getOrCreate()
    spark.sql("use db_hive").show()
    spark.sql("show tables").show()
    println("============")
    spark.sql("select * from city_info").show()


    spark.close()
  }
}
